/*      */ package me.wazup.kitbattle;
/*      */ 
/*      */ import java.sql.Connection;
/*      */ import java.sql.DriverManager;
/*      */ import java.sql.ResultSet;
/*      */ import java.sql.SQLException;
/*      */ import java.sql.Statement;
/*      */ import java.util.ArrayList;
/*      */ import java.util.Arrays;
/*      */ import java.util.Collection;
/*      */ import java.util.HashMap;
/*      */ import java.util.Iterator;
/*      */ import java.util.List;
/*      */ import java.util.Random;
/*      */ import java.util.logging.Logger;
/*      */ import net.milkbowl.vault.economy.Economy;
/*      */ import org.bukkit.Bukkit;
/*      */ import org.bukkit.ChatColor;
/*      */ import org.bukkit.GameMode;
/*      */ import org.bukkit.Location;
/*      */ import org.bukkit.Material;
/*      */ import org.bukkit.OfflinePlayer;
/*      */ import org.bukkit.SkullType;
/*      */ import org.bukkit.World;
/*      */ import org.bukkit.block.Block;
/*      */ import org.bukkit.block.BlockFace;
/*      */ import org.bukkit.block.BlockState;
/*      */ import org.bukkit.block.Sign;
/*      */ import org.bukkit.block.Skull;
/*      */ import org.bukkit.command.Command;
/*      */ import org.bukkit.command.CommandSender;
/*      */ import org.bukkit.configuration.file.FileConfiguration;
/*      */ import org.bukkit.entity.Entity;
/*      */ import org.bukkit.entity.Player;
/*      */ import org.bukkit.inventory.Inventory;
/*      */ import org.bukkit.inventory.ItemStack;
/*      */ import org.bukkit.inventory.meta.ItemMeta;
/*      */ import org.bukkit.material.Sign;
/*      */ import org.bukkit.plugin.Plugin;
/*      */ import org.bukkit.plugin.RegisteredServiceProvider;
/*      */ import org.bukkit.plugin.java.JavaPlugin;
/*      */ import org.bukkit.potion.PotionEffect;
/*      */ import org.bukkit.scheduler.BukkitRunnable;
/*      */ import org.bukkit.scheduler.BukkitTask;
/*      */ import org.bukkit.scoreboard.DisplaySlot;
/*      */ import org.bukkit.scoreboard.Objective;
/*      */ import org.bukkit.scoreboard.Scoreboard;
/*      */ import org.bukkit.scoreboard.ScoreboardManager;
/*      */ 
/*      */ public class main extends JavaPlugin {
/*      */   public static main plugin;
/*   52 */   Logger logger = Logger.getLogger("Minecraft");
/*      */   
/*   54 */   List<String> commands = Arrays.asList(new String[] { "admin", "list", "create", "delete", "setspawn", "join", "leave", "reset", "coins", "setchallenge", "kit", "kitunlocker", "resetkit", "stats", "reload", "info" });
/*      */   
/*   56 */   String kb = ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "KitBattle" + ChatColor.DARK_AQUA + "] " + ChatColor.GRAY;
/*      */   
/*   58 */   Random random = new Random();
/*      */   
/*   60 */   String ListOfMaps = null;
/*      */   
/*   62 */   HashMap<String, Location> maps = new HashMap<String, Location>();
/*   63 */   HashMap<String, PlayerData> playerData = new HashMap<String, PlayerData>();
/*   64 */   HashMap<String, Kit> Kits = new HashMap<String, Kit>();
/*   65 */   HashMap<String, Rank> Ranks = new HashMap<String, Rank>();
/*      */   
/*   67 */   HashMap<String, String> Challenging = new HashMap<String, String>();
/*   68 */   HashMap<String, BukkitTask> Fighting = new HashMap<String, BukkitTask>();
/*      */   
/*   70 */   ArrayList<String> game = new ArrayList<String>();
/*   71 */   ArrayList<String> cantMove = new ArrayList<String>();
/*   72 */   ArrayList<String> openingKitunlocker = new ArrayList<String>();
/*      */   
/*   74 */   ItemStack KitSelector = setName(new ItemStack(Material.CHEST), ChatColor.GRAY + "Kit Selector (" + ChatColor.GREEN + "Right click!" + ChatColor.GRAY + ")");
/*   75 */   ItemStack ShopOpener = setName(new ItemStack(Material.ANVIL), ChatColor.GRAY + "Shop (" + ChatColor.GREEN + "Right click!" + ChatColor.GRAY + ")");
/*   76 */   ItemStack Challenger = setName(new ItemStack(Material.BLAZE_ROD), ChatColor.GREEN + "Right click a player to challenge him!");
/*   77 */   ItemStack KitUnlocker = setName(new ItemStack(Material.CHEST), ChatColor.GRAY + "Kit Unlocker! (" + ChatColor.GREEN + "Right click!" + ChatColor.GRAY + ")");
/*      */   
/*      */   listener listen;
/*      */   
/*      */   AbilityListener abilityListener;
/*      */   Config config;
/*      */   FileManager fileManager;
/*      */   Messages msgs;
/*   85 */   public static Economy econ = null;
/*      */   
/*      */   Connection connection;
/*      */   
/*      */   ScoreboardManager manager;
/*      */   
/*      */   Location challengeLocation1;
/*      */   
/*      */   Location challengeLocation2;
/*   94 */   String currentMap = null;
/*      */   
/*      */   Iterator<String> shuffler;
/*      */   
/*   98 */   String playerNamePrefix = "player_name";
/*      */   
/*      */   BukkitTask Updater;
/*      */   
/*  102 */   int totalUpdates = 0;
/*      */   long nextUpdate;
/*      */   
/*      */   public void onEnable() {
/*  106 */     this.logger.info("[KitBattle] has been enabled!");
/*  107 */     plugin = this;
/*  108 */     this.fileManager = new FileManager(this);
/*  109 */     this.fileManager.setupAll();
/*  110 */     this.fileManager.setupKits();
/*  111 */     this.fileManager.loadKits();
/*  112 */     this.fileManager.setupRanks();
/*  113 */     this.fileManager.loadRanks();
/*  114 */     this.fileManager.setupAbilities();
/*      */     
/*  116 */     this.msgs = new Messages(this.fileManager);
/*  117 */     this.msgs.createDefaultMessages();
/*  118 */     this.msgs.loadMessages();
/*      */     
/*  120 */     this.config = new Config(this);
/*  121 */     this.config.loadConfig();
/*  122 */     this.config.loadAbilities();
/*  123 */     this.config.loadSignPrefixes();
/*      */     
/*  125 */     this.kb = this.msgs.prefix;
/*  126 */     this.listen = new listener(this, this.kb);
/*  127 */     this.abilityListener = new AbilityListener(this, this.kb);
/*  128 */     Bukkit.getPluginManager().registerEvents(this.listen, (Plugin)this);
/*  129 */     Bukkit.getPluginManager().registerEvents(this.abilityListener, (Plugin)this);
/*  130 */     this.manager = Bukkit.getScoreboardManager();
/*      */     
/*  132 */     if (getConfig().getBoolean("use-Vault")) {
/*  133 */       setupEcon();
/*  134 */       if (econ != null) {
/*  135 */         this.logger.info("[KitBattle] Found vault! The option to use vault is enabled, due to that the plugin will use vault instead of coins");
/*      */       } else {
/*  137 */         this.logger.info("[KitBattle] The option to use vault is enabled, but Vault doesn't seem to be installed! due to that the plugin will continue using coins system");
/*      */       } 
/*      */     } 
/*  140 */     if (this.config.useMySQL) {
/*  141 */       (new BukkitRunnable() {
/*      */           public void run() {
/*      */             try {
/*  144 */               main.this.connection = DriverManager.getConnection("jdbc:mysql://" + main.this.config.mysqlhost + ":" + main.this.config.mysqlport + "/" + main.this.config.mysqldatabase, main.this.config.mysqlusername, main.this.config.mysqlpassword);
/*  145 */               main.this.connection.createStatement().executeUpdate("CREATE TABLE IF NOT EXISTS " + main.this.config.tableprefix + " (player_uuid VARCHAR(40), player_name VARCHAR(40), Coins int, Kills int, Deaths int, Exp int, Rank VARCHAR(20), Kitunlockers int, Kits VARCHAR(9999))");
/*  146 */               main.this.fixUpdater();
/*  147 */             } catch (SQLException e) {
/*  148 */               e.printStackTrace();
/*      */             } 
/*      */           }
/*  151 */         }).runTaskAsynchronously((Plugin)this);
/*      */     } else {
/*  153 */       fixUpdater();
/*      */     }  byte b; int i; Player[] arrayOfPlayer;
/*  155 */     for (i = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length, b = 0; b < i; ) { Player p = arrayOfPlayer[b];
/*  156 */       this.playerData.put(p.getName(), new PlayerData(p, this));
/*      */       b++; }
/*      */     
/*  159 */     Bukkit.getScheduler().scheduleSyncDelayedTask((Plugin)this, new Runnable()
/*      */         {
/*      */           public void run() {
/*  162 */             main.this.loadMaps();
/*  163 */             main.this.updateList();
/*  164 */             main.this.loadChallengeLocation();
/*      */             
/*  166 */             if (main.this.config.BungeeMode) {
/*  167 */               if (!main.this.maps.isEmpty()) {
/*  168 */                 main.this.shuffler = main.this.maps.keySet().iterator();
/*  169 */                 if (main.this.maps.size() > 1 && main.this.config.MapShuffle) {
/*  170 */                   main.this.startShuffler();
/*      */                 } else {
/*  172 */                   main.this.currentMap = main.this.shuffler.next();
/*      */                 }  byte b; int i; Player[] arrayOfPlayer;
/*  174 */                 for (i = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length, b = 0; b < i; ) { Player p = arrayOfPlayer[b];
/*  175 */                   p.sendMessage(String.valueOf(main.this.kb) + main.this.msgs.PlayerJoinMap.replace("%map%", main.this.currentMap));
/*  176 */                   main.this.game.add(p.getName());
/*  177 */                   p.teleport(main.this.maps.get(main.this.currentMap));
/*  178 */                   ((PlayerData)main.this.playerData.get(p.getName())).saveData(p, main.this.currentMap);
/*  179 */                   main.this.clearData(p);
/*  180 */                   main.this.giveDefaultItems(p);
/*      */                   try {
/*  182 */                     main.this.createScoreboard(p);
/*  183 */                   } catch (Exception e) {
/*  184 */                     main.this.logger.info("[KitBattle] Couldn't create a scoreboard for the player " + p.getName() + "! the player stats probably didn't load quickly enough");
/*  185 */                     e.printStackTrace();
/*      */                   }  b++; }
/*      */               
/*      */               } else {
/*  189 */                 byte b; int i; Player[] arrayOfPlayer; for (i = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length, b = 0; b < i; ) { Player p = arrayOfPlayer[b];
/*  190 */                   p.kickPlayer(String.valueOf(main.this.kb) + main.this.msgs.NoAvailableMaps);
/*      */                   b++; }
/*      */               
/*      */               } 
/*      */             }
/*      */           }
/*  196 */         }getConfig().getInt("Load-Delay"));
/*      */ 
/*      */     
/*  199 */     if (this.config.UUID) {
/*  200 */       this.playerNamePrefix = "player_uuid";
/*      */     }
/*      */   }
/*      */   
/*      */   public void onDisable() {
/*  205 */     this.logger.info("[KitBattle] has been disabled!");
/*  206 */     for (String playerName : this.game) {
/*  207 */       Player p = Bukkit.getPlayer(playerName);
/*  208 */       p.sendMessage(String.valueOf(this.kb) + this.msgs.pluginReloadKickMessage);
/*  209 */       clearData(p);
/*  210 */       ((PlayerData)this.playerData.get(p.getName())).restoreData(p);
/*      */     } 
/*  212 */     for (Entity e : this.abilityListener.toRemove)
/*  213 */       e.remove();  byte b; int i;
/*      */     Player[] arrayOfPlayer;
/*  215 */     for (i = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length, b = 0; b < i; ) { Player x = arrayOfPlayer[b];
/*  216 */       ((PlayerData)this.playerData.get(x.getName())).saveStatsIntoFile(x, true); b++; }
/*      */     
/*  218 */     for (BlockState state : this.abilityListener.toRollback) {
/*  219 */       this.abilityListener.Rollback(state);
/*      */     }
/*      */   }
/*      */   
/*      */   public boolean onCommand(final CommandSender sender, Command cmd, String commandLabel, final String[] args) {
/*  224 */     if (commandLabel.equalsIgnoreCase("kb") || commandLabel.equalsIgnoreCase("kitbattle")) {
/*  225 */       if (args.length == 0) {
/*  226 */         sender.sendMessage(ChatColor.DARK_AQUA + ChatColor.STRIKETHROUGH + " ----------" + ChatColor.AQUA + " KitBattle " + ChatColor.DARK_AQUA + ChatColor.STRIKETHROUGH + "----------");
/*  227 */         sender.sendMessage(ChatColor.DARK_AQUA + " - " + ChatColor.AQUA + "/kb" + ChatColor.DARK_AQUA + " - " + ChatColor.GRAY + "Main command");
/*  228 */         sender.sendMessage(ChatColor.DARK_AQUA + " - " + ChatColor.AQUA + "/kb " + ChatColor.GREEN + "List" + ChatColor.DARK_AQUA + " - " + ChatColor.GRAY + "Shows a list of maps");
/*  229 */         sender.sendMessage(ChatColor.DARK_AQUA + " - " + ChatColor.AQUA + "/kb " + ChatColor.GREEN + "Stats" + ChatColor.DARK_AQUA + " - " + ChatColor.GRAY + "View your stats");
/*  230 */         if (!this.config.BungeeMode) {
/*  231 */           sender.sendMessage(ChatColor.DARK_AQUA + " - " + ChatColor.AQUA + "/kb " + ChatColor.GREEN + "Join" + ChatColor.DARK_AQUA + " - " + ChatColor.GRAY + "Join the selected map");
/*  232 */           sender.sendMessage(ChatColor.DARK_AQUA + " - " + ChatColor.AQUA + "/kb " + ChatColor.GREEN + "Leave" + ChatColor.DARK_AQUA + " - " + ChatColor.GRAY + "Leave your current map");
/*      */         } 
/*  234 */         sender.sendMessage(ChatColor.DARK_AQUA + " - " + ChatColor.AQUA + "/kb " + ChatColor.GREEN + "Resetkit" + ChatColor.DARK_AQUA + " - " + ChatColor.GRAY + "Reset your current kit!");
/*  235 */         sender.sendMessage(ChatColor.DARK_AQUA + " - " + ChatColor.AQUA + "/kb " + ChatColor.GREEN + "Info" + ChatColor.DARK_AQUA + " - " + ChatColor.GRAY + "Shows some information");
/*  236 */         sender.sendMessage(ChatColor.DARK_AQUA + " - " + ChatColor.AQUA + "/kb " + ChatColor.RED + "Admin" + ChatColor.DARK_AQUA + " - " + ChatColor.GRAY + "Shows the admin commands");
/*  237 */         sender.sendMessage(ChatColor.DARK_AQUA + ChatColor.STRIKETHROUGH + " --------------------------");
/*  238 */         return true;
/*      */       } 
/*  240 */       if (!this.commands.contains(args[0].toLowerCase())) {
/*  241 */         sender.sendMessage(String.valueOf(this.kb) + this.msgs.UnknownCommand);
/*  242 */         return true;
/*      */       } 
/*  244 */       if (args[0].equalsIgnoreCase("join")) {
/*  245 */         if (sender instanceof Player) {
/*  246 */           Player p = (Player)sender;
/*  247 */           if (this.config.BungeeMode) {
/*  248 */             p.sendMessage(String.valueOf(this.kb) + this.msgs.CommandDisabled);
/*  249 */             return true;
/*      */           } 
/*  251 */           if (args.length == 1) {
/*  252 */             p.sendMessage(String.valueOf(this.kb) + "Usage: /kb " + ChatColor.GREEN + "Join" + ChatColor.GRAY + " <Map>");
/*  253 */             return true;
/*      */           } 
/*  255 */           String mapName = args[1].toLowerCase();
/*  256 */           if (!this.maps.containsKey(mapName)) {
/*  257 */             p.sendMessage(String.valueOf(this.kb) + this.msgs.UnknownMap);
/*  258 */             return true;
/*      */           } 
/*  260 */           p.sendMessage(String.valueOf(this.kb) + this.msgs.PlayerJoinMap.replace("%map%", mapName));
/*  261 */           if (this.game.contains(p.getName())) {
/*  262 */             clearData(p);
/*  263 */             p.teleport(this.maps.get(mapName));
/*  264 */             giveDefaultItems(p);
/*  265 */             ((PlayerData)this.playerData.get(p.getName())).setMap(mapName);
/*  266 */             ((PlayerData)this.playerData.get(p.getName())).setKit(null);
/*  267 */             ((PlayerData)this.playerData.get(p.getName())).killstreak = 0;
/*  268 */             removeFromChallenge(p);
/*      */           } else {
/*  270 */             this.game.add(p.getName());
/*  271 */             ((PlayerData)this.playerData.get(p.getName())).saveData(p, mapName);
/*  272 */             clearData(p);
/*  273 */             p.teleport(this.maps.get(mapName));
/*  274 */             giveDefaultItems(p);
/*  275 */             createScoreboard(p);
/*      */           } 
/*      */         } else {
/*  278 */           sender.sendMessage(String.valueOf(this.kb) + this.msgs.noconsole);
/*      */         }
/*      */       
/*  281 */       } else if (args[0].equalsIgnoreCase("leave")) {
/*  282 */         if (sender instanceof Player) {
/*  283 */           Player p = (Player)sender;
/*  284 */           if (this.config.BungeeMode) {
/*  285 */             p.sendMessage(String.valueOf(this.kb) + this.msgs.CommandDisabled);
/*  286 */             return true;
/*      */           } 
/*  288 */           if (this.game.contains(p.getName())) {
/*  289 */             leave(p);
/*      */           } else {
/*  291 */             p.sendMessage(String.valueOf(this.kb) + this.msgs.NotInAGame);
/*      */           } 
/*      */         } else {
/*  294 */           sender.sendMessage(String.valueOf(this.kb) + this.msgs.noconsole);
/*      */         }
/*      */       
/*  297 */       } else if (args[0].equalsIgnoreCase("admin")) {
/*  298 */         if (sender.hasPermission("kitbattle.admin")) {
/*  299 */           sender.sendMessage(ChatColor.DARK_AQUA + ChatColor.STRIKETHROUGH + " ----------" + ChatColor.AQUA + " KitBattle Admin " + ChatColor.DARK_AQUA + ChatColor.STRIKETHROUGH + "----------");
/*  300 */           if (!this.config.BungeeMode) {
/*  301 */             sender.sendMessage(ChatColor.DARK_AQUA + " - " + ChatColor.AQUA + "/kb " + ChatColor.GREEN + "Create" + ChatColor.DARK_AQUA + " - " + ChatColor.GRAY + "Create a new map!");
/*  302 */             sender.sendMessage(ChatColor.DARK_AQUA + " - " + ChatColor.AQUA + "/kb " + ChatColor.GREEN + "Delete" + ChatColor.DARK_AQUA + " - " + ChatColor.GRAY + "Delete a map!");
/*      */           } 
/*  304 */           sender.sendMessage(ChatColor.DARK_AQUA + " - " + ChatColor.AQUA + "/kb " + ChatColor.GREEN + "Setspawn" + ChatColor.DARK_AQUA + " - " + ChatColor.GRAY + "Change a map spawnpoint location");
/*  305 */           sender.sendMessage(ChatColor.DARK_AQUA + " - " + ChatColor.AQUA + "/kb " + ChatColor.GREEN + "Reset" + ChatColor.DARK_AQUA + " - " + ChatColor.GRAY + "Resets a player data");
/*  306 */           sender.sendMessage(ChatColor.DARK_AQUA + " - " + ChatColor.AQUA + "/kb " + ChatColor.GREEN + "Coins" + ChatColor.DARK_AQUA + " - " + ChatColor.GRAY + "Modify a player coins");
/*  307 */           sender.sendMessage(ChatColor.DARK_AQUA + " - " + ChatColor.AQUA + "/kb " + ChatColor.GREEN + "Setchallenge" + ChatColor.DARK_AQUA + " - " + ChatColor.GRAY + "Sets the location for challenges");
/*  308 */           sender.sendMessage(ChatColor.DARK_AQUA + " - " + ChatColor.AQUA + "/kb " + ChatColor.GREEN + "Kit" + ChatColor.DARK_AQUA + " - " + ChatColor.GRAY + "Modify the kits");
/*  309 */           sender.sendMessage(ChatColor.DARK_AQUA + " - " + ChatColor.AQUA + "/kb " + ChatColor.GREEN + "KitUnlocker" + ChatColor.DARK_AQUA + " - " + ChatColor.GRAY + "Give a player Kitunlockers");
/*  310 */           sender.sendMessage(ChatColor.DARK_AQUA + " - " + ChatColor.AQUA + "/kb " + ChatColor.GREEN + "Reload" + ChatColor.DARK_AQUA + " - " + ChatColor.GRAY + "Reload the config files");
/*  311 */           sender.sendMessage(ChatColor.DARK_AQUA + ChatColor.STRIKETHROUGH + " ---------------------------------");
/*      */         } else {
/*  313 */           sender.sendMessage(String.valueOf(this.kb) + this.msgs.nopermission);
/*      */         }
/*      */       
/*  316 */       } else if (args[0].equalsIgnoreCase("list")) {
/*  317 */         if (this.ListOfMaps == null) {
/*  318 */           sender.sendMessage(String.valueOf(this.kb) + this.msgs.NoAvailableMaps);
/*  319 */           return true;
/*      */         } 
/*  321 */         sender.sendMessage(String.valueOf(this.kb) + "List: " + this.ListOfMaps);
/*      */       }
/*  323 */       else if (args[0].equalsIgnoreCase("stats")) {
/*  324 */         if (sender instanceof Player) {
/*  325 */           Player p = (Player)sender;
/*  326 */           Player target = (args.length == 1) ? p : Bukkit.getPlayer(args[1]);
/*  327 */           if (target == null) {
/*  328 */             p.sendMessage(String.valueOf(this.kb) + this.msgs.PlayerNotFound);
/*  329 */             return true;
/*      */           } 
/*  331 */           PlayerData data = this.playerData.get(target.getName());
/*  332 */           p.sendMessage(ChatColor.DARK_AQUA + ChatColor.STRIKETHROUGH + " ----------" + ChatColor.YELLOW + " " + target.getName() + ChatColor.AQUA + " Stats " + ChatColor.DARK_AQUA + ChatColor.STRIKETHROUGH + "----------");
/*  333 */           p.sendMessage(ChatColor.AQUA + "Kills: " + ChatColor.GREEN + data.kills);
/*  334 */           p.sendMessage(ChatColor.AQUA + "Deaths: " + ChatColor.GREEN + data.deaths);
/*  335 */           p.sendMessage(ChatColor.AQUA + "Coins: " + ChatColor.GREEN + data.coins);
/*  336 */           p.sendMessage(ChatColor.AQUA + "Exp: " + ChatColor.GREEN + data.dataexp);
/*  337 */           p.sendMessage(ChatColor.AQUA + "Rank: " + ChatColor.GREEN + data.rank.getName());
/*  338 */           p.sendMessage(ChatColor.AQUA + "KDR: " + ChatColor.GREEN + (data.kills / ((data.deaths > 0) ? Double.valueOf(data.deaths).doubleValue() : 1.0D)));
/*  339 */           p.sendMessage(ChatColor.DARK_AQUA + ChatColor.STRIKETHROUGH + " ---------------------------------");
/*      */         } else {
/*  341 */           sender.sendMessage(String.valueOf(this.kb) + this.msgs.noconsole);
/*      */         }
/*      */       
/*  344 */       } else if (args[0].equalsIgnoreCase("reload")) {
/*  345 */         if (sender.hasPermission("kitbattle.reload")) {
/*      */           
/*  347 */           this.fileManager.setupAll();
/*  348 */           this.fileManager.setupKits();
/*  349 */           this.Kits.clear();
/*  350 */           this.fileManager.loadKits();
/*  351 */           this.fileManager.setupRanks();
/*  352 */           this.Ranks.clear();
/*  353 */           this.fileManager.loadRanks();
/*  354 */           this.fileManager.setupAbilities();
/*  355 */           this.msgs.createDefaultMessages();
/*  356 */           this.msgs.loadMessages();
/*  357 */           this.config.loadConfig();
/*  358 */           this.config.loadAbilities();
/*  359 */           this.config.loadSignPrefixes();
/*  360 */           this.kb = this.msgs.prefix;
/*  361 */           this.listen.kb = this.kb;
/*  362 */           this.abilityListener.kb = this.kb;
/*  363 */           this.maps.clear();
/*  364 */           loadMaps();
/*  365 */           updateList();
/*  366 */           loadChallengeLocation();
/*  367 */           if (getConfig().getBoolean("use-Vault")) {
/*  368 */             setupEcon();
/*  369 */             if (econ != null) {
/*  370 */               this.logger.info("[KitBattle] Found vault! The option to use vault is enabled, due to that the plugin will use vault instead of coins");
/*      */             } else {
/*  372 */               this.logger.info("[KitBattle] The option to use vault is enabled, but Vault doesn't seem to be installed! due to that the plugin will continue using coins system");
/*      */             } 
/*  374 */           }  if (this.config.useMySQL) {
/*  375 */             (new BukkitRunnable() {
/*      */                 public void run() {
/*      */                   try {
/*  378 */                     if (main.this.connection == null) {
/*  379 */                       main.this.connection = DriverManager.getConnection("jdbc:mysql://" + main.this.config.mysqlhost + ":" + main.this.config.mysqlport + "/" + main.this.config.mysqldatabase, main.this.config.mysqlusername, main.this.config.mysqlpassword);
/*      */                     }
/*  381 */                     main.this.connection.createStatement().executeUpdate("CREATE TABLE IF NOT EXISTS " + main.this.config.tableprefix + " (player_uuid VARCHAR(40), player_name VARCHAR(40), Coins int, Kills int, Deaths int, Exp int, Rank VARCHAR(20), Kitunlockers int, Kits VARCHAR(9999))");
/*  382 */                   } catch (SQLException e) {
/*  383 */                     e.printStackTrace();
/*      */                   } 
/*      */                 }
/*  386 */               }).runTaskAsynchronously((Plugin)this);
/*      */           }
/*  388 */           if (this.config.BungeeMode && this.maps.isEmpty()) {
/*  389 */             byte b1; int j; Player[] arrayOfPlayer1; for (j = (arrayOfPlayer1 = Bukkit.getOnlinePlayers()).length, b1 = 0; b1 < j; ) { Player p = arrayOfPlayer1[b1];
/*  390 */               p.kickPlayer(String.valueOf(this.kb) + this.msgs.NoAvailableMaps); b1++; }
/*      */           
/*      */           }  byte b; int i; Player[] arrayOfPlayer;
/*  393 */           for (i = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length, b = 0; b < i; ) { Player p = arrayOfPlayer[b];
/*  394 */             PlayerData data = this.playerData.get(p.getName());
/*  395 */             if (data.getMap() != null && !this.maps.containsKey(data.getMap())) {
/*  396 */               if (this.config.BungeeMode) {
/*  397 */                 if (!this.Fighting.containsKey(p.getName())) {
/*  398 */                   clearData(p);
/*  399 */                   ((PlayerData)this.playerData.get(p.getName())).setKit(null);
/*  400 */                   giveDefaultItems(p);
/*  401 */                   p.teleport(this.maps.get(this.currentMap));
/*      */                 } 
/*  403 */                 ((PlayerData)this.playerData.get(p.getName())).setMap(this.currentMap);
/*      */               }
/*  405 */               else if (this.maps.isEmpty()) {
/*  406 */                 p.sendMessage(String.valueOf(this.kb) + this.msgs.MapDeletedKick);
/*  407 */                 p.performCommand("kb leave");
/*      */               } else {
/*  409 */                 p.sendMessage(String.valueOf(this.kb) + this.msgs.MapDeletedSendToAnotherMap);
/*  410 */                 p.performCommand("kb join " + (String)this.maps.keySet().iterator().next());
/*      */               } 
/*      */             }
/*      */             
/*  414 */             ArrayList<String> ownedKits = new ArrayList<String>(); byte b1; int j; ItemStack[] arrayOfItemStack;
/*  415 */             for (j = (arrayOfItemStack = data.myKits.getContents()).length, b1 = 0; b1 < j; ) { ItemStack item = arrayOfItemStack[b1];
/*  416 */               if (item == null)
/*  417 */                 break;  ownedKits.add(ChatColor.stripColor(item.getItemMeta().getDisplayName().toLowerCase())); b1++; }
/*      */             
/*  419 */             data.myKits.clear();
/*  420 */             data.Shop.clear();
/*  421 */             for (String kitss : ownedKits) {
/*  422 */               if (this.Kits.containsKey(kitss)) {
/*  423 */                 data.myKits.addItem(new ItemStack[] { ((Kit)this.Kits.get(kitss)).getLogo() });
/*      */               }
/*      */             } 
/*  426 */             for (String kitName : this.Kits.keySet()) {
/*  427 */               if (!ownedKits.contains(kitName))
/*  428 */                 data.Shop.addItem(new ItemStack[] { ((Kit)this.Kits.get(kitName)).getShopLogo() }); 
/*      */             } 
/*      */             b++; }
/*      */           
/*  432 */           if (this.config.UUID) {
/*  433 */             this.playerNamePrefix = "player_uuid";
/*      */           } else {
/*  435 */             this.playerNamePrefix = "player_name";
/*      */           } 
/*  437 */           fixUpdater();
/*      */           
/*  439 */           sender.sendMessage(String.valueOf(this.kb) + "The plugin has been reloaded");
/*      */         } else {
/*  441 */           sender.sendMessage(String.valueOf(this.kb) + this.msgs.nopermission);
/*      */         }
/*      */       
/*  444 */       } else if (args[0].equalsIgnoreCase("resetkit")) {
/*  445 */         if (sender instanceof Player) {
/*  446 */           Player p = (Player)sender;
/*  447 */           if (p.hasPermission("kitbattle.resetkit")) {
/*  448 */             if (((PlayerData)this.playerData.get(p.getName())).getKit() == null) {
/*  449 */               p.sendMessage(String.valueOf(this.kb) + this.msgs.MustHaveSelectedKit);
/*  450 */               return true;
/*      */             } 
/*  452 */             String kitName = ((PlayerData)this.playerData.get(p.getName())).getKit().getName();
/*  453 */             ((PlayerData)this.playerData.get(p.getName())).setKit(null);
/*  454 */             p.getInventory().clear();
/*  455 */             p.getInventory().setArmorContents(null);
/*  456 */             for (PotionEffect effect : p.getActivePotionEffects()) {
/*  457 */               p.removePotionEffect(effect.getType());
/*      */             }
/*  459 */             p.setAllowFlight(false);
/*  460 */             p.setFlying(false);
/*  461 */             giveDefaultItems(p);
/*  462 */             p.sendMessage(String.valueOf(this.kb) + this.msgs.PlayerResetKit.replace("%kit%", kitName));
/*      */           } else {
/*  464 */             p.sendMessage(String.valueOf(this.kb) + this.msgs.nopermission);
/*      */           } 
/*      */         } else {
/*  467 */           sender.sendMessage(String.valueOf(this.kb) + this.msgs.noconsole);
/*      */         }
/*      */       
/*  470 */       } else if (args[0].equalsIgnoreCase("create")) {
/*  471 */         if (sender instanceof Player) {
/*  472 */           Player p = (Player)sender;
/*  473 */           if (p.hasPermission("kitbattle.create")) {
/*  474 */             if (this.config.BungeeMode) {
/*  475 */               p.sendMessage(String.valueOf(this.kb) + this.msgs.CommandDisabled);
/*  476 */               return true;
/*      */             } 
/*  478 */             if (args.length == 1) {
/*  479 */               p.sendMessage(String.valueOf(this.kb) + "Usage: /kb " + ChatColor.GREEN + "Create" + ChatColor.GRAY + " <Map>");
/*  480 */               return true;
/*      */             } 
/*  482 */             String mapName = args[1].toLowerCase();
/*  483 */             if (this.maps.containsKey(mapName)) {
/*  484 */               p.sendMessage(String.valueOf(this.kb) + "There is already a map with that name!");
/*  485 */               return true;
/*      */             } 
/*  487 */             setSpawn(mapName, p.getLocation());
/*  488 */             this.maps.put(mapName, p.getLocation());
/*  489 */             updateList();
/*  490 */             p.sendMessage(String.valueOf(this.kb) + "The map " + ChatColor.AQUA + mapName + ChatColor.GRAY + " has been created successfully! the default location is set to (" + ChatColor.AQUA + p.getLocation().getBlockX() + ChatColor.GRAY + ", " + ChatColor.AQUA + p.getLocation().getBlockY() + ChatColor.GRAY + ", " + ChatColor.AQUA + p.getLocation().getBlockZ() + ChatColor.GRAY + ") to change it use /kb " + ChatColor.GREEN + "Setspawn " + ChatColor.AQUA + mapName);
/*      */           } else {
/*  492 */             p.sendMessage(String.valueOf(this.kb) + this.msgs.nopermission);
/*      */           } 
/*      */         } else {
/*  495 */           sender.sendMessage(String.valueOf(this.kb) + this.msgs.noconsole);
/*      */         }
/*      */       
/*  498 */       } else if (args[0].equalsIgnoreCase("delete")) {
/*  499 */         if (sender.hasPermission("kitbattle.delete")) {
/*  500 */           if (this.config.BungeeMode) {
/*  501 */             sender.sendMessage(String.valueOf(this.kb) + this.msgs.CommandDisabled);
/*  502 */             return true;
/*      */           } 
/*  504 */           if (args.length == 1) {
/*  505 */             sender.sendMessage(String.valueOf(this.kb) + "Usage: /kb " + ChatColor.GREEN + "Delete" + ChatColor.GRAY + " <Map>");
/*  506 */             return true;
/*      */           } 
/*  508 */           String mapName = args[1].toLowerCase();
/*  509 */           if (!this.maps.containsKey(mapName)) {
/*  510 */             sender.sendMessage(String.valueOf(this.kb) + this.msgs.UnknownMap);
/*  511 */             return true;
/*      */           } 
/*  513 */           this.fileManager.getMapsConfig().set("Maps." + mapName, null);
/*  514 */           this.fileManager.saveMapsConfig();
/*  515 */           this.maps.remove(mapName);
/*  516 */           updateList();
/*  517 */           ArrayList<String> toRemove = new ArrayList<String>();
/*  518 */           for (String players : this.game) {
/*  519 */             if (((PlayerData)this.playerData.get(players)).getMap().equalsIgnoreCase(mapName)) {
/*  520 */               Player x = Bukkit.getPlayer(players);
/*  521 */               if (this.maps.isEmpty()) {
/*  522 */                 x.sendMessage(String.valueOf(this.kb) + this.msgs.MapDeletedKick);
/*  523 */                 toRemove.add(players); continue;
/*      */               } 
/*  525 */               x.sendMessage(String.valueOf(this.kb) + this.msgs.MapDeletedSendToAnotherMap);
/*  526 */               x.performCommand("kb join " + (String)this.maps.keySet().iterator().next());
/*      */             } 
/*      */           } 
/*      */           
/*  530 */           for (String x : toRemove) {
/*  531 */             Bukkit.getPlayer(x).performCommand("kb leave");
/*      */           }
/*  533 */           sender.sendMessage(String.valueOf(this.kb) + "The map " + ChatColor.AQUA + mapName + ChatColor.GRAY + " was deleted successfully!");
/*      */         } else {
/*  535 */           sender.sendMessage(String.valueOf(this.kb) + this.msgs.nopermission);
/*      */         }
/*      */       
/*  538 */       } else if (args[0].equalsIgnoreCase("setspawn")) {
/*  539 */         if (sender instanceof Player) {
/*  540 */           Player p = (Player)sender;
/*  541 */           if (p.hasPermission("kitbattle.setspawn")) {
/*  542 */             if (args.length == 1) {
/*  543 */               p.sendMessage(String.valueOf(this.kb) + "Usage: /kb " + ChatColor.GREEN + "Setspawn" + ChatColor.GRAY + " <Map>");
/*  544 */               return true;
/*      */             } 
/*  546 */             String mapName = args[1].toLowerCase();
/*  547 */             if (!this.maps.containsKey(mapName)) {
/*  548 */               p.sendMessage(String.valueOf(this.kb) + this.msgs.UnknownMap);
/*  549 */               return true;
/*      */             } 
/*  551 */             setSpawn(mapName, p.getLocation());
/*  552 */             this.maps.put(mapName, p.getLocation());
/*  553 */             p.sendMessage(String.valueOf(this.kb) + "You have changed the map " + ChatColor.AQUA + mapName + ChatColor.GRAY + " spawnpoint location to (" + ChatColor.AQUA + p.getLocation().getBlockX() + ChatColor.GRAY + ", " + ChatColor.AQUA + p.getLocation().getBlockY() + ChatColor.GRAY + ", " + ChatColor.AQUA + p.getLocation().getBlockZ() + ChatColor.GRAY + ")");
/*      */           } else {
/*  555 */             p.sendMessage(String.valueOf(this.kb) + this.msgs.nopermission);
/*      */           } 
/*      */         } else {
/*  558 */           sender.sendMessage(String.valueOf(this.kb) + this.msgs.noconsole);
/*      */         }
/*      */       
/*  561 */       } else if (args[0].equalsIgnoreCase("reset")) {
/*  562 */         if (sender.hasPermission("kitbattle.reset")) {
/*  563 */           if (args.length == 1) {
/*  564 */             sender.sendMessage(String.valueOf(this.kb) + "Usage: /kb " + ChatColor.GREEN + "Reset" + ChatColor.GRAY + " <Player>");
/*  565 */             return true;
/*      */           } 
/*  567 */           Player p = Bukkit.getPlayer(args[1]);
/*  568 */           if (p != null) {
/*  569 */             PlayerData data = this.playerData.get(p.getName());
/*  570 */             data.joined = true;
/*  571 */             data.coins = this.config.StartingCoins;
/*  572 */             data.kills = 0;
/*  573 */             data.deaths = 0;
/*  574 */             data.dataexp = 0;
/*  575 */             data.rank = Rank.orderd.get(0);
/*  576 */             data.rankNumber = 0;
/*  577 */             data.kitUnlockers = this.config.StartingAmountOfKitUnlockers;
/*  578 */             data.updateNextRank();
/*  579 */             data.myKits.clear();
/*  580 */             List<String> ownedKits = new ArrayList<String>();
/*  581 */             for (String x : this.config.defaultKits) {
/*  582 */               ownedKits.add(x.toLowerCase());
/*      */             }
/*  584 */             for (String kitss : ownedKits) {
/*  585 */               if (this.Kits.containsKey(kitss)) {
/*  586 */                 data.myKits.addItem(new ItemStack[] { ((Kit)this.Kits.get(kitss)).getLogo() });
/*      */               }
/*      */             } 
/*  589 */             data.Shop.clear();
/*  590 */             for (String kitName : this.Kits.keySet()) {
/*  591 */               if (!ownedKits.contains(kitName) && 
/*  592 */                 this.Kits.containsKey(kitName)) {
/*  593 */                 data.Shop.addItem(new ItemStack[] { ((Kit)this.Kits.get(kitName)).getShopLogo() });
/*      */               }
/*      */             } 
/*      */             
/*  597 */             if (this.game.contains(p.getName())) {
/*  598 */               createScoreboard(p);
/*  599 */               if (data.getKit() == null) {
/*  600 */                 p.getInventory().clear();
/*  601 */                 giveDefaultItems(p);
/*      */               } 
/*      */             } 
/*  604 */             sender.sendMessage(String.valueOf(this.kb) + "The player " + ChatColor.AQUA + args[1] + ChatColor.GRAY + " data has been " + ChatColor.GREEN + "successfully " + ChatColor.GRAY + "cleared!");
/*      */           } else {
/*  606 */             sender.sendMessage(String.valueOf(this.kb) + "Couldn't find that player!");
/*      */           } 
/*      */         } else {
/*  609 */           sender.sendMessage(String.valueOf(this.kb) + this.msgs.nopermission);
/*      */         }
/*      */       
/*  612 */       } else if (args[0].equalsIgnoreCase("coins")) {
/*  613 */         if (sender.hasPermission("kitbattle.coins")) {
/*  614 */           if (args.length < 4 || (!args[1].equalsIgnoreCase("add") && !args[1].equalsIgnoreCase("set") && !args[1].equalsIgnoreCase("remove")) || !isNumber(args[3])) {
/*  615 */             sender.sendMessage(String.valueOf(this.kb) + "Usage: /kb " + ChatColor.GREEN + "Coins" + ChatColor.GRAY + " Add/Set/Remove <Player> <Amount>");
/*  616 */             return true;
/*      */           } 
/*  618 */           Player p = Bukkit.getPlayer(args[2]);
/*  619 */           if (p != null) {
/*  620 */             PlayerData data = this.playerData.get(p.getName());
/*  621 */             int amount = Integer.valueOf(args[3]).intValue();
/*  622 */             String command = args[1].toLowerCase();
/*  623 */             int previousCoins = getCoins(p);
/*      */             
/*  625 */             if (command.equals("add")) {
/*  626 */               addCoins(p, amount);
/*  627 */               sender.sendMessage(String.valueOf(this.kb) + "You gave the player " + ChatColor.AQUA + p.getName() + ChatColor.GRAY + " (" + ChatColor.GREEN + amount + ChatColor.GRAY + ") coins!");
/*  628 */               p.sendMessage(String.valueOf(this.kb) + this.msgs.PlayerGainCoinsThroughCommand.replace("%coins%", String.valueOf(amount)));
/*      */             }
/*  630 */             else if (command.equals("set")) {
/*  631 */               setCoins(p, amount);
/*  632 */               sender.sendMessage(String.valueOf(this.kb) + "You have set the player " + ChatColor.AQUA + p.getName() + ChatColor.GRAY + " coins to (" + ChatColor.GREEN + amount + ChatColor.GRAY + ")");
/*  633 */               p.sendMessage(String.valueOf(this.kb) + this.msgs.PlayerCoinsSetThroughCommand.replace("%coins%", String.valueOf(amount)));
/*      */             }
/*  635 */             else if (command.equals("remove")) {
/*  636 */               removeCoins(p, amount);
/*  637 */               sender.sendMessage(String.valueOf(this.kb) + "You have removed (" + ChatColor.GREEN + amount + ChatColor.GRAY + ") coins from the player " + ChatColor.AQUA + p.getName() + ChatColor.GRAY + "!");
/*  638 */               p.sendMessage(String.valueOf(this.kb) + this.msgs.PlayerLoseCoinsThroughCommand.replace("%coins%", String.valueOf(amount)));
/*      */             } 
/*      */             
/*  641 */             if (this.game.contains(p.getName())) {
/*      */               try {
/*  643 */                 Scoreboard board = p.getScoreboard();
/*  644 */                 if (board.getObjective(DisplaySlot.SIDEBAR) == null || !board.getObjective(DisplaySlot.SIDEBAR).getDisplayName().equals(ChatColor.YELLOW + ChatColor.BOLD + ChatColor.UNDERLINE + "KitBattle")) {
/*  645 */                   createScoreboard(p);
/*      */                 } else {
/*  647 */                   Objective obj = board.getObjective(DisplaySlot.SIDEBAR);
/*  648 */                   board.resetScores(this.msgs.scoreboard_coins.replace("%coins%", String.valueOf(previousCoins)));
/*  649 */                   obj.getScore(this.msgs.scoreboard_coins.replace("%coins%", String.valueOf(getCoins(p)))).setScore(1);
/*      */                 } 
/*  651 */               } catch (Exception x) {
/*  652 */                 x.printStackTrace();
/*  653 */                 this.logger.info("[KitBattle] Error has occured while creating/updating the player: " + p.getName() + " scoreboard!");
/*      */               } 
/*      */             }
/*      */           } else {
/*  657 */             sender.sendMessage(String.valueOf(this.kb) + "Couldn't find that player!");
/*      */           } 
/*      */         } else {
/*  660 */           sender.sendMessage(String.valueOf(this.kb) + this.msgs.nopermission);
/*      */         }
/*      */       
/*  663 */       } else if (args[0].equalsIgnoreCase("setchallenge")) {
/*  664 */         if (sender instanceof Player) {
/*  665 */           if (sender.hasPermission("kitbattle.setchallenge")) {
/*  666 */             Player p = (Player)sender;
/*  667 */             if (args.length == 1 || !isNumber(args[1]) || Integer.valueOf(args[1]).intValue() > 2 || Integer.valueOf(args[1]).intValue() < 1) {
/*  668 */               p.sendMessage(String.valueOf(this.kb) + "Usage: /kb " + ChatColor.GREEN + "Setchallenge " + ChatColor.GRAY + "1/2");
/*  669 */               return true;
/*      */             } 
/*  671 */             int id = Integer.valueOf(args[1]).intValue();
/*  672 */             if (id == 2) {
/*  673 */               this.challengeLocation2 = p.getLocation().add(0.0D, 1.0D, 0.0D);
/*      */             } else {
/*  675 */               this.challengeLocation1 = p.getLocation().add(0.0D, 1.0D, 0.0D);
/*      */             } 
/*  677 */             getConfig().set("Challenge-Location." + id + ".world", p.getWorld().getName());
/*  678 */             getConfig().set("Challenge-Location." + id + ".x", Integer.valueOf(p.getLocation().getBlockX()));
/*  679 */             getConfig().set("Challenge-Location." + id + ".y", Integer.valueOf(p.getLocation().getBlockY() + 1));
/*  680 */             getConfig().set("Challenge-Location." + id + ".z", Integer.valueOf(p.getLocation().getBlockZ()));
/*  681 */             getConfig().set("Challenge-Location." + id + ".yaw", Float.valueOf(p.getLocation().getYaw()));
/*  682 */             getConfig().set("Challenge-Location." + id + ".pitch", Float.valueOf(p.getLocation().getPitch()));
/*  683 */             saveConfig();
/*  684 */             p.sendMessage(String.valueOf(this.kb) + "The " + ChatColor.GREEN + "1v1" + ChatColor.GRAY + " challenge location " + ChatColor.LIGHT_PURPLE + "#" + id + ChatColor.GRAY + " has been set! (" + ChatColor.AQUA + p.getLocation().getBlockX() + ChatColor.GRAY + ", " + ChatColor.AQUA + p.getLocation().getBlockY() + ChatColor.GRAY + ", " + ChatColor.AQUA + p.getLocation().getBlockZ() + ChatColor.GRAY + ")");
/*      */           } else {
/*  686 */             sender.sendMessage(String.valueOf(this.kb) + this.msgs.nopermission);
/*      */           } 
/*      */         } else {
/*  689 */           sender.sendMessage(String.valueOf(this.kb) + this.msgs.noconsole);
/*      */         }
/*      */       
/*  692 */       } else if (args[0].equalsIgnoreCase("kit")) {
/*  693 */         if (sender.hasPermission("kitbattle.kit")) {
/*  694 */           if (args.length == 1 || (!args[1].equalsIgnoreCase("Create") && !args[1].equalsIgnoreCase("Delete") && !args[1].equalsIgnoreCase("Rename") && !args[1].equalsIgnoreCase("Enable") && !args[1].equalsIgnoreCase("Disable"))) {
/*  695 */             sender.sendMessage(String.valueOf(this.kb) + "Usage: /kb " + ChatColor.GREEN + "Kit " + ChatColor.GRAY + "Create/Delete/Rename/Enable/Disable");
/*  696 */             return true;
/*      */           } 
/*  698 */           String command = args[1].toLowerCase();
/*  699 */           if (command.equals("create")) {
/*  700 */             if (sender instanceof Player) {
/*  701 */               ItemStack logo; Player p = (Player)sender;
/*  702 */               if (args.length < 5 || !isMaterial(args[3].split(":")[0].toUpperCase()) || !isNumber(args[4])) {
/*  703 */                 p.sendMessage(String.valueOf(this.kb) + "Usage: /kb " + ChatColor.GREEN + "Kit " + ChatColor.GRAY + "Create <Name> <Logo " + ChatColor.LIGHT_PURPLE + ChatColor.UNDERLINE + "(MATERIAL ENUM) " + ChatColor.GRAY + "> <Price>");
/*  704 */                 return true;
/*      */               } 
/*  706 */               String name = args[2];
/*  707 */               if (this.Kits.containsKey(name.toLowerCase())) {
/*  708 */                 p.sendMessage(String.valueOf(this.kb) + "There is already a kit with that name!");
/*  709 */                 return true;
/*      */               } 
/*  711 */               int price = Integer.valueOf(args[4]).intValue();
/*      */               
/*  713 */               if (args[3].contains(":")) {
/*  714 */                 logo = setName(new ItemStack(Material.valueOf(args[3].split(":")[0].toUpperCase()), 1, Short.valueOf(args[3].split(":")[1]).shortValue()), ChatColor.LIGHT_PURPLE + name);
/*      */               } else {
/*  716 */                 logo = setName(new ItemStack(Material.valueOf(args[3].toUpperCase())), ChatColor.GREEN + name);
/*      */               } 
/*  718 */               String description = ChatColor.AQUA + "There is no description for this kit!";
/*  719 */               addLore(logo, description);
/*  720 */               ItemStack[] items = p.getInventory().getContents();
/*  721 */               ItemStack[] armor = p.getInventory().getArmorContents();
/*  722 */               Collection<PotionEffect> effects = p.getActivePotionEffects();
/*  723 */               Kit kit = new Kit(name, logo, items, armor, price, effects, new ArrayList<Ability>(), true, false);
/*  724 */               this.Kits.put(name.toLowerCase(), kit);
/*  725 */               for (PlayerData data : this.playerData.values()) {
/*  726 */                 data.getShop().addItem(new ItemStack[] { kit.getShopLogo() });
/*      */               } 
/*  728 */               this.fileManager.getKitsConfig().set("Kits." + name + ".Enabled", Boolean.valueOf(true));
/*  729 */               this.fileManager.getKitsConfig().set("Kits." + name + ".Require-Permission", Boolean.valueOf(false));
/*  730 */               this.fileManager.getKitsConfig().set("Kits." + name + ".Item", args[3].toUpperCase());
/*  731 */               this.fileManager.getKitsConfig().set("Kits." + name + ".Price", Integer.valueOf(price));
/*  732 */               this.fileManager.getKitsConfig().set("Kits." + name + ".Armor.Helmet", this.fileManager.transformItemStackToString(p.getInventory().getHelmet()));
/*  733 */               this.fileManager.getKitsConfig().set("Kits." + name + ".Armor.Chestplate", this.fileManager.transformItemStackToString(p.getInventory().getChestplate()));
/*  734 */               this.fileManager.getKitsConfig().set("Kits." + name + ".Armor.Leggings", this.fileManager.transformItemStackToString(p.getInventory().getLeggings()));
/*  735 */               this.fileManager.getKitsConfig().set("Kits." + name + ".Armor.Boots", this.fileManager.transformItemStackToString(p.getInventory().getBoots()));
/*  736 */               ArrayList<String> itemsInInv = new ArrayList<String>(); byte b; int i; ItemStack[] arrayOfItemStack;
/*  737 */               for (i = (arrayOfItemStack = items).length, b = 0; b < i; ) { ItemStack stack = arrayOfItemStack[b];
/*  738 */                 itemsInInv.add(this.fileManager.transformItemStackToString(stack)); b++; }
/*      */               
/*  740 */               this.fileManager.getKitsConfig().set("Kits." + name + ".Items", itemsInInv);
/*  741 */               ArrayList<String> potionsTransformed = new ArrayList<String>();
/*  742 */               for (PotionEffect effect : effects) {
/*  743 */                 potionsTransformed.add(String.valueOf(effect.getType().getName()) + " : " + (effect.getDuration() / 20) + " : " + effect.getAmplifier());
/*      */               }
/*  745 */               this.fileManager.getKitsConfig().set("Kits." + name + ".Abilities", Arrays.asList(new String[0]));
/*  746 */               this.fileManager.getKitsConfig().set("Kits." + name + ".Potion-Effects", potionsTransformed);
/*  747 */               description = "&b" + ChatColor.stripColor(description);
/*  748 */               this.fileManager.getKitsConfig().set("Kits." + name + ".Description", Arrays.asList(new String[] { description }));
/*  749 */               this.fileManager.saveKitsConfig();
/*  750 */               p.getInventory().clear();
/*  751 */               p.getInventory().setArmorContents(null);
/*  752 */               for (PotionEffect effect : p.getActivePotionEffects()) {
/*  753 */                 p.removePotionEffect(effect.getType());
/*      */               }
/*  755 */               p.sendMessage(String.valueOf(this.kb) + "The " + ChatColor.GREEN + name + ChatColor.GRAY + " kit has been created!");
/*      */             } else {
/*  757 */               sender.sendMessage(String.valueOf(this.kb) + this.msgs.noconsole);
/*      */             }
/*      */           
/*  760 */           } else if (command.equals("delete")) {
/*  761 */             if (args.length == 2) {
/*  762 */               sender.sendMessage(String.valueOf(this.kb) + "Usage: /kb " + ChatColor.GREEN + "Delete" + ChatColor.GRAY + " <Kit>");
/*  763 */               return true;
/*      */             } 
/*  765 */             String kitName = args[2].toLowerCase();
/*  766 */             if (!this.Kits.containsKey(kitName)) {
/*  767 */               sender.sendMessage(String.valueOf(this.kb) + "Couldn't find a kit with that name!");
/*  768 */               return true;
/*      */             } 
/*  770 */             String configName = ((Kit)this.Kits.get(kitName)).getName();
/*  771 */             ItemStack logo = ((Kit)this.Kits.get(kitName)).getLogo();
/*  772 */             ItemStack shopLogo = ((Kit)this.Kits.get(kitName)).getShopLogo();
/*  773 */             this.Kits.remove(kitName);
/*  774 */             this.fileManager.getKitsConfig().set("Kits." + configName, null);
/*  775 */             this.fileManager.saveKitsConfig();
/*  776 */             for (PlayerData data : this.playerData.values()) {
/*  777 */               if (data.getShop().contains(shopLogo)) {
/*  778 */                 data.getShop().remove(shopLogo);
/*  779 */                 organizeInventory(data.getShop()); continue;
/*      */               } 
/*  781 */               if (data.getMyKits().contains(logo)) {
/*  782 */                 data.getMyKits().removeItem(new ItemStack[] { logo });
/*  783 */                 organizeInventory(data.getMyKits());
/*      */               } 
/*      */             } 
/*  786 */             sender.sendMessage(String.valueOf(this.kb) + "The kit " + ChatColor.GREEN + configName + ChatColor.GRAY + " has been deleted!");
/*      */           }
/*  788 */           else if (command.equals("rename")) {
/*      */             
/*  790 */             if (this.config.useMySQL) {
/*  791 */               sender.sendMessage(String.valueOf(this.kb) + "This command is coming soon for MySql users!");
/*  792 */               return true;
/*      */             } 
/*  794 */             if (args.length < 4) {
/*  795 */               sender.sendMessage(String.valueOf(this.kb) + "Usage: /kb " + ChatColor.GREEN + "Kit" + ChatColor.GRAY + " rename <Kit> <New Name>");
/*  796 */               return true;
/*      */             } 
/*  798 */             String kitName = args[2].toLowerCase();
/*  799 */             if (!this.Kits.containsKey(kitName)) {
/*  800 */               sender.sendMessage(String.valueOf(this.kb) + "Couldn't find a kit with that name!");
/*  801 */               return true;
/*      */             } 
/*  803 */             if (this.Kits.containsKey(args[3].toLowerCase())) {
/*  804 */               sender.sendMessage(String.valueOf(this.kb) + "There is already a kit with that name!");
/*  805 */               return true;
/*      */             } 
/*  807 */             Kit currentKit = this.Kits.get(kitName);
/*  808 */             String path = "Kits." + currentKit.getName() + ".";
/*  809 */             boolean Enabled = this.fileManager.getKitsConfig().getBoolean(String.valueOf(path) + "Enabled");
/*  810 */             boolean RequirePermission = this.fileManager.getKitsConfig().getBoolean(String.valueOf(path) + "Require-Permission");
/*  811 */             String Item = this.fileManager.getKitsConfig().getString(String.valueOf(path) + "Item");
/*  812 */             int Price = this.fileManager.getKitsConfig().getInt(String.valueOf(path) + "Price");
/*  813 */             String Helmet = this.fileManager.getKitsConfig().getString(String.valueOf(path) + "Armor.Helmet");
/*  814 */             String Chestplate = this.fileManager.getKitsConfig().getString(String.valueOf(path) + "Armor.Chestplate");
/*  815 */             String Leggings = this.fileManager.getKitsConfig().getString(String.valueOf(path) + "Armor.Leggings");
/*  816 */             String Boots = this.fileManager.getKitsConfig().getString(String.valueOf(path) + "Armor.Boots");
/*  817 */             List<String> items = this.fileManager.getKitsConfig().getStringList(String.valueOf(path) + "Items");
/*  818 */             List<String> potions = this.fileManager.getKitsConfig().getStringList(String.valueOf(path) + "Potion-Effects");
/*  819 */             List<String> abilities = this.fileManager.getKitsConfig().getStringList(String.valueOf(path) + "Abilities");
/*  820 */             List<String> description = this.fileManager.getKitsConfig().getStringList(String.valueOf(path) + "Description");
/*      */             
/*  822 */             this.fileManager.getKitsConfig().set("Kits." + currentKit.getName(), null);
/*      */             
/*  824 */             this.fileManager.getKitsConfig().set("Kits." + args[3] + ".Enabled", Boolean.valueOf(Enabled));
/*  825 */             this.fileManager.getKitsConfig().set("Kits." + args[3] + ".Require-Permission", Boolean.valueOf(RequirePermission));
/*  826 */             this.fileManager.getKitsConfig().set("Kits." + args[3] + ".Item", Item);
/*  827 */             this.fileManager.getKitsConfig().set("Kits." + args[3] + ".Price", Integer.valueOf(Price));
/*  828 */             this.fileManager.getKitsConfig().set("Kits." + args[3] + ".Armor.Helmet", Helmet);
/*  829 */             this.fileManager.getKitsConfig().set("Kits." + args[3] + ".Armor.Chestplate", Chestplate);
/*  830 */             this.fileManager.getKitsConfig().set("Kits." + args[3] + ".Armor.Leggings", Leggings);
/*  831 */             this.fileManager.getKitsConfig().set("Kits." + args[3] + ".Armor.Boots", Boots);
/*  832 */             this.fileManager.getKitsConfig().set("Kits." + args[3] + ".Items", items);
/*  833 */             this.fileManager.getKitsConfig().set("Kits." + args[3] + ".Abilities", abilities);
/*  834 */             this.fileManager.getKitsConfig().set("Kits." + args[3] + ".Potion-Effects", potions);
/*  835 */             this.fileManager.getKitsConfig().set("Kits." + args[3] + ".Description", description);
/*  836 */             this.fileManager.saveKitsConfig();
/*  837 */             ItemStack previousLogo = currentKit.getLogo().clone();
/*  838 */             ItemStack previousShopLogo = currentKit.getShopLogo().clone();
/*  839 */             this.Kits.remove(kitName);
/*  840 */             currentKit.setName(args[3]);
/*  841 */             setName(currentKit.getLogo(), ChatColor.GREEN + args[3]);
/*  842 */             setName(currentKit.getShopLogo(), ChatColor.LIGHT_PURPLE + args[3]);
/*  843 */             this.Kits.put(args[3].toLowerCase(), currentKit);
/*  844 */             ItemStack newLogo = currentKit.getLogo();
/*  845 */             ItemStack newShopLogo = currentKit.getShopLogo();
/*  846 */             for (PlayerData data : this.playerData.values()) {
/*  847 */               if (data.getShop().contains(previousShopLogo)) {
/*  848 */                 data.getShop().removeItem(new ItemStack[] { previousShopLogo });
/*  849 */                 data.getShop().addItem(new ItemStack[] { newShopLogo }); continue;
/*      */               } 
/*  851 */               if (data.getMyKits().contains(previousLogo)) {
/*  852 */                 data.getMyKits().removeItem(new ItemStack[] { previousLogo });
/*  853 */                 data.getMyKits().addItem(new ItemStack[] { newLogo });
/*      */               } 
/*      */             } 
/*  856 */             final String oldName = ChatColor.stripColor(previousLogo.getItemMeta().getDisplayName());
/*  857 */             sender.sendMessage(String.valueOf(this.kb) + "The kit " + ChatColor.LIGHT_PURPLE + oldName + ChatColor.GRAY + " has been renamed to " + ChatColor.GREEN + args[3] + ChatColor.GRAY + "!");
/*      */             
/*  859 */             (new BukkitRunnable() {
/*  860 */                 Iterator<String> iterator = main.this.fileManager.getPlayersConfig().getConfigurationSection("Players").getKeys(false).iterator();
/*  861 */                 int updated = 0;
/*      */                 public void run() {
/*  863 */                   int i = 0;
/*  864 */                   while (i < 50 && this.iterator.hasNext()) {
/*  865 */                     i++;
/*  866 */                     String playerName = this.iterator.next();
/*  867 */                     if (main.this.fileManager.getPlayersConfig().getStringList("Players." + playerName + ".Kits").contains(oldName)) {
/*  868 */                       List<String> currentList = main.this.fileManager.getPlayersConfig().getStringList("Players." + playerName + ".Kits");
/*  869 */                       currentList.remove(oldName);
/*  870 */                       currentList.add(args[3]);
/*  871 */                       main.this.fileManager.getPlayersConfig().set("Players." + playerName + ".Kits", currentList);
/*  872 */                       this.updated++;
/*      */                     } 
/*      */                   } 
/*  875 */                   if (!this.iterator.hasNext()) {
/*  876 */                     main.this.fileManager.savePlayersConfig();
/*  877 */                     sender.sendMessage(String.valueOf(main.this.kb) + "Updated the owned kits in the file for " + ChatColor.LIGHT_PURPLE + this.updated + ChatColor.GRAY + " players!");
/*  878 */                     cancel();
/*      */                   } 
/*      */                 }
/*  881 */               }).runTaskTimerAsynchronously((Plugin)this, 1L, 2L);
/*      */           
/*      */           }
/*  884 */           else if (command.equals("enable")) {
/*  885 */             if (args.length < 3) {
/*  886 */               sender.sendMessage(String.valueOf(this.kb) + "Usage: /kb " + ChatColor.GREEN + "Kit" + ChatColor.GRAY + " enable <Kit>");
/*  887 */               return true;
/*      */             } 
/*  889 */             Kit kit = this.Kits.get(args[2].toLowerCase());
/*  890 */             if (kit == null) {
/*  891 */               sender.sendMessage(String.valueOf(this.kb) + "Couldn't find a kit with that name!");
/*  892 */               return true;
/*      */             } 
/*  894 */             if (kit.enabled) {
/*  895 */               sender.sendMessage(String.valueOf(this.kb) + "This kit is already enabled!");
/*  896 */               return true;
/*      */             } 
/*  898 */             kit.enabled = true;
/*  899 */             this.fileManager.getKitsConfig().set("Kits." + kit.getName() + ".Enabled", Boolean.valueOf(true));
/*  900 */             this.fileManager.saveKitsConfig();
/*  901 */             ItemStack previousLogo = kit.getLogo().clone();
/*  902 */             ItemStack previousShopLogo = kit.getShopLogo().clone();
/*  903 */             replaceLore(kit.getLogo(), ChatColor.BLUE + "State: " + ChatColor.RED + "Disabled", ChatColor.BLUE + "State: " + ChatColor.GREEN + "Enabled");
/*  904 */             replaceLore(kit.getShopLogo(), ChatColor.BLUE + "State: " + ChatColor.RED + "Disabled", ChatColor.BLUE + "State: " + ChatColor.GREEN + "Enabled");
/*  905 */             for (PlayerData data : this.playerData.values()) {
/*  906 */               if (data.getShop().contains(previousShopLogo)) {
/*  907 */                 data.getShop().removeItem(new ItemStack[] { previousShopLogo });
/*  908 */                 data.getShop().addItem(new ItemStack[] { kit.getShopLogo() }); continue;
/*      */               } 
/*  910 */               data.getMyKits().removeItem(new ItemStack[] { previousLogo });
/*  911 */               data.getMyKits().addItem(new ItemStack[] { kit.getLogo() });
/*      */             } 
/*      */             
/*  914 */             sender.sendMessage(String.valueOf(this.kb) + "You have " + ChatColor.GREEN + "enabled" + ChatColor.GRAY + " the kit " + ChatColor.LIGHT_PURPLE + kit.getName());
/*      */           }
/*  916 */           else if (command.equals("disable")) {
/*  917 */             if (args.length < 3) {
/*  918 */               sender.sendMessage(String.valueOf(this.kb) + "Usage: /kb " + ChatColor.GREEN + "Kit" + ChatColor.GRAY + " disable <Kit>");
/*  919 */               return true;
/*      */             } 
/*  921 */             Kit kit = this.Kits.get(args[2].toLowerCase());
/*  922 */             if (kit == null) {
/*  923 */               sender.sendMessage(String.valueOf(this.kb) + "Couldn't find a kit with that name!");
/*  924 */               return true;
/*      */             } 
/*  926 */             if (!kit.enabled) {
/*  927 */               sender.sendMessage(String.valueOf(this.kb) + "This kit is already disabled!");
/*  928 */               return true;
/*      */             } 
/*  930 */             kit.enabled = false;
/*  931 */             this.fileManager.getKitsConfig().set("Kits." + kit.getName() + ".Enabled", Boolean.valueOf(false));
/*  932 */             this.fileManager.saveKitsConfig();
/*  933 */             ItemStack previousLogo = kit.getLogo().clone();
/*  934 */             ItemStack previousShopLogo = kit.getShopLogo().clone();
/*  935 */             replaceLore(kit.getLogo(), ChatColor.BLUE + "State: " + ChatColor.GREEN + "Enabled", ChatColor.BLUE + "State: " + ChatColor.RED + "Disabled");
/*  936 */             replaceLore(kit.getShopLogo(), ChatColor.BLUE + "State: " + ChatColor.GREEN + "Enabled", ChatColor.BLUE + "State: " + ChatColor.RED + "Disabled");
/*  937 */             for (PlayerData data : this.playerData.values()) {
/*  938 */               if (data.getShop().contains(previousShopLogo)) {
/*  939 */                 data.getShop().removeItem(new ItemStack[] { previousShopLogo });
/*  940 */                 data.getShop().addItem(new ItemStack[] { kit.getShopLogo() }); continue;
/*      */               } 
/*  942 */               data.getMyKits().removeItem(new ItemStack[] { previousLogo });
/*  943 */               data.getMyKits().addItem(new ItemStack[] { kit.getLogo() });
/*      */             } 
/*      */             
/*  946 */             sender.sendMessage(String.valueOf(this.kb) + "You have " + ChatColor.RED + "disabled" + ChatColor.GRAY + " the kit " + ChatColor.LIGHT_PURPLE + kit.getName());
/*      */           } 
/*      */         } else {
/*  949 */           sender.sendMessage(String.valueOf(this.kb) + this.msgs.nopermission);
/*      */         }
/*      */       
/*  952 */       } else if (args[0].equalsIgnoreCase("kitunlocker")) {
/*  953 */         if (sender.hasPermission("kitbattle.kitunlocker")) {
/*  954 */           if (args.length < 4 || !isNumber(args[3]) || !args[1].equalsIgnoreCase("give")) {
/*  955 */             sender.sendMessage(String.valueOf(this.kb) + "Usage: /kb " + ChatColor.GREEN + "Kitunlocker" + ChatColor.GRAY + " give <Player> <Amount>");
/*  956 */             return true;
/*      */           } 
/*  958 */           Player p = Bukkit.getPlayer(args[2]);
/*  959 */           if (p == null) {
/*  960 */             sender.sendMessage(String.valueOf(this.kb) + "Couldn't find that player!");
/*  961 */             return true;
/*      */           } 
/*  963 */           ((PlayerData)this.playerData.get(p.getName())).kitUnlockers += Integer.valueOf(args[3]).intValue();
/*  964 */           ((PlayerData)this.playerData.get(p.getName())).joined = true;
/*  965 */           if (this.game.contains(p.getName()) && ((PlayerData)this.playerData.get(p.getName())).getKit() == null) {
/*  966 */             p.getInventory().clear();
/*  967 */             giveDefaultItems(p);
/*      */           } 
/*  969 */           p.sendMessage(String.valueOf(this.kb) + this.msgs.PlayerReceiveKitUnlocker.replace("%amount%", args[3]));
/*  970 */           sender.sendMessage(String.valueOf(this.kb) + ChatColor.GREEN + p.getName() + ChatColor.GRAY + " has received " + ChatColor.LIGHT_PURPLE + args[3] + ChatColor.GRAY + " Kitunlockers successfully");
/*      */         } else {
/*  972 */           sender.sendMessage(String.valueOf(this.kb) + this.msgs.nopermission);
/*      */         }
/*      */       
/*  975 */       } else if (args[0].equalsIgnoreCase("info")) {
/*  976 */         sender.sendMessage(ChatColor.DARK_AQUA + ChatColor.STRIKETHROUGH + " ----------" + ChatColor.AQUA + " Information " + ChatColor.DARK_AQUA + ChatColor.STRIKETHROUGH + "----------");
/*  977 */         sender.sendMessage(ChatColor.AQUA + "Version: " + ChatColor.GREEN + getDescription().getVersion());
/*  978 */         sender.sendMessage(ChatColor.AQUA + "Vault: " + ChatColor.GREEN + ((econ != null) ? 1 : 0));
/*  979 */         sender.sendMessage(ChatColor.AQUA + "UUID: " + ChatColor.GREEN + this.config.UUID);
/*  980 */         sender.sendMessage(ChatColor.AQUA + "MySQL: " + ChatColor.GREEN + this.config.useMySQL);
/*  981 */         sender.sendMessage(ChatColor.AQUA + "Updater Running: " + ChatColor.GREEN + ((this.Updater != null) ? 1 : 0));
/*  982 */         long Seconds = (this.nextUpdate == 0L) ? 0L : ((this.nextUpdate - System.currentTimeMillis()) / 1000L);
/*  983 */         sender.sendMessage(ChatColor.AQUA + "Next Update: " + ChatColor.GREEN + Seconds + "s " + ChatColor.AQUA + "(" + ChatColor.LIGHT_PURPLE + (Seconds / 60L) + "m" + ChatColor.AQUA + ")");
/*  984 */         sender.sendMessage(ChatColor.AQUA + "Total Updates: " + ChatColor.GREEN + this.totalUpdates);
/*  985 */         sender.sendMessage(ChatColor.DARK_AQUA + ChatColor.STRIKETHROUGH + " ---------------------------------");
/*      */       } 
/*      */     } 
/*  988 */     return true;
/*      */   }
/*      */   
/*      */   public void loadMaps() {
/*  992 */     this.maps.clear();
/*  993 */     if (this.fileManager.getMapsConfig().getConfigurationSection("Maps") == null)
/*  994 */       return;  for (String mapName : this.fileManager.getMapsConfig().getConfigurationSection("Maps").getKeys(false)) {
/*  995 */       String world = this.fileManager.getMapsConfig().getString("Maps." + mapName + ".world");
/*  996 */       int x = this.fileManager.getMapsConfig().getInt("Maps." + mapName + ".x");
/*  997 */       int y = this.fileManager.getMapsConfig().getInt("Maps." + mapName + ".y");
/*  998 */       int z = this.fileManager.getMapsConfig().getInt("Maps." + mapName + ".z");
/*  999 */       int yaw = this.fileManager.getMapsConfig().getInt("Maps." + mapName + ".yaw");
/* 1000 */       int pitch = this.fileManager.getMapsConfig().getInt("Maps." + mapName + ".pitch");
/* 1001 */       this.maps.put(mapName.toLowerCase(), new Location(Bukkit.getWorld(world), x, y, z, yaw, pitch));
/*      */     } 
/*      */   }
/*      */   
/*      */   public void updateList() {
/* 1006 */     if (this.maps.isEmpty()) {
/* 1007 */       this.ListOfMaps = null;
/*      */       return;
/*      */     } 
/* 1010 */     Iterator<String> iterator = this.maps.keySet().iterator();
/* 1011 */     this.ListOfMaps = ChatColor.AQUA + (String)iterator.next();
/* 1012 */     while (iterator.hasNext()) {
/* 1013 */       this.ListOfMaps = String.valueOf(this.ListOfMaps) + ChatColor.GRAY + ", " + ChatColor.AQUA + (String)iterator.next();
/*      */     }
/*      */   }
/*      */   
/*      */   public void setSpawn(String mapName, Location location) {
/* 1018 */     this.fileManager.getMapsConfig().set("Maps." + mapName + ".world", location.getWorld().getName());
/* 1019 */     this.fileManager.getMapsConfig().set("Maps." + mapName + ".x", Integer.valueOf(location.getBlockX()));
/* 1020 */     this.fileManager.getMapsConfig().set("Maps." + mapName + ".y", Integer.valueOf(location.getBlockY()));
/* 1021 */     this.fileManager.getMapsConfig().set("Maps." + mapName + ".z", Integer.valueOf(location.getBlockZ()));
/* 1022 */     this.fileManager.getMapsConfig().set("Maps." + mapName + ".yaw", Float.valueOf(location.getYaw()));
/* 1023 */     this.fileManager.getMapsConfig().set("Maps." + mapName + ".pitch", Float.valueOf(location.getPitch()));
/* 1024 */     this.fileManager.saveMapsConfig();
/*      */   }
/*      */   
/*      */   public void clearData(Player p) {
/* 1028 */     p.getInventory().clear();
/* 1029 */     p.getInventory().setArmorContents(null);
/* 1030 */     p.setHealth(20.0D);
/* 1031 */     p.setFoodLevel(20);
/* 1032 */     p.setLevel(0);
/* 1033 */     p.setExp(0.0F);
/* 1034 */     for (PotionEffect effect : p.getActivePotionEffects()) {
/* 1035 */       p.removePotionEffect(effect.getType());
/*      */     }
/* 1037 */     p.setGameMode(GameMode.SURVIVAL);
/* 1038 */     p.setAllowFlight(false);
/* 1039 */     p.setFlying(false);
/* 1040 */     p.setFireTicks(0);
/*      */   }
/*      */ 
/*      */   
/* 1044 */   public String target(Player p) { return this.config.UUID ? p.getUniqueId().toString() : p.getName(); }
/*      */ 
/*      */   
/*      */   public void createScoreboard(Player p) {
/* 1048 */     PlayerData data = this.playerData.get(p.getName());
/* 1049 */     Scoreboard board = this.manager.getNewScoreboard();
/* 1050 */     Objective objective = board.registerNewObjective("KitBattle", "dummy");
/* 1051 */     objective.setDisplaySlot(DisplaySlot.SIDEBAR);
/* 1052 */     objective.setDisplayName(this.msgs.scoreboard_prefix);
/* 1053 */     objective.getScore("  ").setScore(5);
/* 1054 */     objective.getScore(this.msgs.scoreboard_stats).setScore(4);
/* 1055 */     objective.getScore(this.msgs.scoreboard_kills.replace("%kills%", String.valueOf(data.getKills()))).setScore(3);
/* 1056 */     objective.getScore(this.msgs.scoreboard_deaths.replace("%deaths%", String.valueOf(data.getDeaths()))).setScore(2);
/* 1057 */     objective.getScore(this.msgs.scoreboard_coins.replace("%coins%", String.valueOf(getCoins(p)))).setScore(1);
/* 1058 */     objective.getScore(" ").setScore(0);
/* 1059 */     objective.getScore(this.msgs.scoreboard_exp.replace("%exp%", String.valueOf(data.getExp()))).setScore(-1);
/* 1060 */     objective.getScore(this.msgs.scoreboard_rank).setScore(-2);
/* 1061 */     objective.getScore(this.msgs.scoreboard_rankname.replace("%rank%", data.getRank().getName())).setScore(-3);
/* 1062 */     if (data.getNextRank() != null) {
/* 1063 */       objective.getScore(this.msgs.scoreboard_nextrank).setScore(-4);
/* 1064 */       objective.getScore(this.msgs.scoreboard_nextrankname.replace("%requiredexp%", String.valueOf(data.getNextRank().getRequiredExp() - data.getExp()))).setScore(-5);
/*      */     } 
/* 1066 */     p.setScoreboard(board);
/*      */   }
/*      */   
/*      */   public void giveDefaultItems(Player p) {
/* 1070 */     p.getInventory().addItem(new ItemStack[] { this.KitSelector });
/* 1071 */     p.getInventory().addItem(new ItemStack[] { this.ShopOpener });
/* 1072 */     if (this.challengeLocation1 != null && this.challengeLocation2 != null) {
/* 1073 */       p.getInventory().addItem(new ItemStack[] { this.Challenger });
/*      */     }
/* 1075 */     if (((PlayerData)this.playerData.get(p.getName())).kitUnlockers > 0) {
/* 1076 */       ItemStack stack = this.KitUnlocker.clone();
/* 1077 */       stack.setAmount(((PlayerData)this.playerData.get(p.getName())).kitUnlockers);
/* 1078 */       p.getInventory().setItem(8, stack);
/*      */     } 
/* 1080 */     ((PlayerData)this.playerData.get(p.getName())).cooldown = 0L;
/* 1081 */     p.updateInventory();
/*      */   }
/*      */   
/*      */   public ItemStack setName(ItemStack stack, String name) {
/* 1085 */     ItemMeta meta = stack.getItemMeta();
/* 1086 */     meta.setDisplayName(name);
/* 1087 */     stack.setItemMeta(meta);
/* 1088 */     return stack;
/*      */   }
/*      */   
/*      */   public void addLore(ItemStack is, String lore) {
/* 1092 */     ItemMeta meta = is.getItemMeta();
/* 1093 */     List<String> lores = new ArrayList<String>();
/* 1094 */     if (meta.getLore() != null) lores = meta.getLore(); 
/* 1095 */     lores.add(lore);
/* 1096 */     meta.setLore(lores);
/* 1097 */     is.setItemMeta(meta);
/*      */   }
/*      */   
/*      */   public void replaceLore(ItemStack is, String oldLore, String newLore) {
/* 1101 */     ItemMeta meta = is.getItemMeta();
/* 1102 */     if (meta.getLore() == null)
/* 1103 */       return;  List<String> original = meta.getLore();
/* 1104 */     List<String> newLoreList = new ArrayList<String>();
/* 1105 */     for (String lore : original) {
/* 1106 */       if (lore.equals(oldLore)) {
/* 1107 */         newLoreList.add(lore.replace(oldLore, newLore)); continue;
/*      */       } 
/* 1109 */       newLoreList.add(lore);
/*      */     } 
/* 1111 */     meta.setLore(newLoreList);
/* 1112 */     is.setItemMeta(meta);
/*      */   }
/*      */   
/*      */   public boolean isNumber(String target) {
/*      */     try {
/* 1117 */       Integer.parseInt(target);
/* 1118 */       return true;
/* 1119 */     } catch (NumberFormatException e) {
/* 1120 */       return false;
/*      */     } 
/*      */   }
/*      */   
/*      */   public boolean isMaterial(String target) {
/*      */     try {
/* 1126 */       Material.valueOf(target);
/* 1127 */       return true;
/* 1128 */     } catch (IllegalArgumentException e) {
/* 1129 */       return false;
/*      */     } 
/*      */   }
/*      */   
/*      */   public void loadChallengeLocation() {
/* 1134 */     if (getConfig().contains("Challenge-Location.1")) {
/* 1135 */       String world = getConfig().getString("Challenge-Location.1.world");
/* 1136 */       int x = getConfig().getInt("Challenge-Location.1.x");
/* 1137 */       int y = getConfig().getInt("Challenge-Location.1.y");
/* 1138 */       int z = getConfig().getInt("Challenge-Location.1.z");
/* 1139 */       int yaw = getConfig().getInt("Challenge-Location.1.yaw");
/* 1140 */       int pitch = getConfig().getInt("Challenge-Location.1.pitch");
/* 1141 */       this.challengeLocation1 = new Location(Bukkit.getWorld(world), x, y, z, yaw, pitch);
/*      */     } 
/* 1143 */     if (getConfig().contains("Challenge-Location.2")) {
/* 1144 */       String world = getConfig().getString("Challenge-Location.2.world");
/* 1145 */       int x = getConfig().getInt("Challenge-Location.2.x");
/* 1146 */       int y = getConfig().getInt("Challenge-Location.2.y");
/* 1147 */       int z = getConfig().getInt("Challenge-Location.2.z");
/* 1148 */       int yaw = getConfig().getInt("Challenge-Location.2.yaw");
/* 1149 */       int pitch = getConfig().getInt("Challenge-Location.2.pitch");
/* 1150 */       this.challengeLocation2 = new Location(Bukkit.getWorld(world), x, y, z, yaw, pitch);
/*      */     } 
/*      */   }
/*      */   
/*      */   public void removeFromChallenge(Player p) {
/* 1155 */     this.cantMove.remove(p.getName());
/* 1156 */     if (this.Fighting.containsKey(p.getName())) {
/* 1157 */       fixVisiblity(p);
/* 1158 */       Player target = Bukkit.getPlayer(this.Challenging.get(p.getName()));
/* 1159 */       target.sendMessage(String.valueOf(this.kb) + this.msgs.PlayerQuitInChallenge.replace("%player%", p.getName()));
/* 1160 */       this.cantMove.remove(target.getName());
/* 1161 */       this.Fighting.remove(target.getName());
/* 1162 */       this.Challenging.remove(target.getName());
/* 1163 */       clearData(target);
/* 1164 */       ((PlayerData)this.playerData.get(target.getName())).setKit(null);
/* 1165 */       target.teleport(this.maps.get(((PlayerData)this.playerData.get(target.getName())).getMap()));
/* 1166 */       this.listen.spawnFirework(target.getLocation());
/* 1167 */       giveDefaultItems(target);
/* 1168 */       ((BukkitTask)this.Fighting.get(p.getName())).cancel();
/*      */     } 
/* 1170 */     this.Fighting.remove(p.getName());
/* 1171 */     this.Challenging.remove(p.getName());
/*      */   }
/*      */   
/*      */   public void fixVisiblity(Player p) {
/* 1175 */     for (String s : this.Fighting.keySet()) {
/* 1176 */       Player x = Bukkit.getPlayer(s);
/* 1177 */       x.showPlayer(p);
/* 1178 */       p.showPlayer(x);
/*      */     } 
/*      */   }
/*      */   
/*      */   public void leave(Player p) {
/* 1183 */     this.game.remove(p.getName());
/* 1184 */     clearData(p);
/* 1185 */     ((PlayerData)this.playerData.get(p.getName())).killstreak = 0;
/* 1186 */     ((PlayerData)this.playerData.get(p.getName())).restoreData(p);
/* 1187 */     p.sendMessage(String.valueOf(this.kb) + this.msgs.PlayerLeave);
/* 1188 */     removeFromChallenge(p);
/*      */   }
/*      */ 
/*      */   
/* 1192 */   public void startShuffler() { (new BukkitRunnable() {
/*      */         public void run() {
/* 1194 */           if (!main.this.shuffler.hasNext()) {
/* 1195 */             main.this.shuffler = main.this.maps.keySet().iterator();
/*      */           }
/* 1197 */           main.this.currentMap = main.this.shuffler.next(); byte b; int i; Player[] arrayOfPlayer;
/* 1198 */           for (i = (arrayOfPlayer = Bukkit.getOnlinePlayers()).length, b = 0; b < i; ) { Player p = arrayOfPlayer[b];
/* 1199 */             if (!main.this.Fighting.containsKey(p.getName())) {
/* 1200 */               main.this.clearData(p);
/* 1201 */               ((PlayerData)main.this.playerData.get(p.getName())).setKit(null);
/* 1202 */               main.this.giveDefaultItems(p);
/* 1203 */               p.teleport(main.this.maps.get(main.this.currentMap));
/*      */             } 
/* 1205 */             ((PlayerData)main.this.playerData.get(p.getName())).setMap(main.this.currentMap);
/* 1206 */             p.sendMessage(String.valueOf(main.this.kb) + main.this.msgs.MapSwitch.replace("%map%", main.this.currentMap));
/*      */             b++; }
/*      */            }
/* 1209 */       }).runTaskTimer((Plugin)this, 0L, (1200 * this.config.ShuffleEveryInMinutes)); }
/*      */ 
/*      */   
/*      */   private void setupEcon() {
/* 1213 */     RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(Economy.class);
/* 1214 */     if (economyProvider != null) {
/* 1215 */       econ = (Economy)economyProvider.getProvider();
/*      */     }
/*      */   }
/*      */   
/*      */   public int getCoins(Player p) {
/* 1220 */     if (econ != null) {
/* 1221 */       return (int)econ.getBalance((OfflinePlayer)p);
/*      */     }
/* 1223 */     return ((PlayerData)this.playerData.get(p.getName())).coins;
/*      */   }
/*      */ 
/*      */   
/*      */   public void addCoins(Player p, int Coins) {
/* 1228 */     if (econ != null) {
/* 1229 */       econ.depositPlayer((OfflinePlayer)p, Coins);
/*      */     } else {
/* 1231 */       PlayerData data = this.playerData.get(p.getName());
/* 1232 */       data.coins += Coins;
/* 1233 */       if (!data.joined) data.joined = true; 
/*      */     } 
/*      */   }
/*      */   
/*      */   public void removeCoins(Player p, int Coins) {
/* 1238 */     if (econ != null) {
/* 1239 */       econ.withdrawPlayer((OfflinePlayer)p, Coins);
/*      */     } else {
/* 1241 */       PlayerData data = this.playerData.get(p.getName());
/* 1242 */       data.coins -= Coins;
/* 1243 */       if (!data.joined) data.joined = true; 
/*      */     } 
/*      */   }
/*      */   
/*      */   public void setCoins(Player p, int Coins) {
/* 1248 */     if (econ != null) {
/* 1249 */       int value = Coins - getCoins(p);
/* 1250 */       if (value > 0) {
/* 1251 */         econ.depositPlayer((OfflinePlayer)p, value);
/*      */       } else {
/* 1253 */         econ.withdrawPlayer((OfflinePlayer)p, -value);
/*      */       } 
/*      */     } else {
/* 1256 */       PlayerData data = this.playerData.get(p.getName());
/* 1257 */       data.coins = Coins;
/* 1258 */       if (!data.joined) data.joined = true; 
/*      */     } 
/*      */   }
/*      */   
/*      */   public void organizeInventory(Inventory inv) {
/* 1263 */     int maxSlots = inv.getSize() - 1;
/* 1264 */     for (int i = 0; i < maxSlots; i++) {
/* 1265 */       if (inv.getItem(i) == null) {
/* 1266 */         for (int x = i; x < maxSlots; x++) {
/* 1267 */           inv.setItem(x, inv.getItem(x + 1));
/* 1268 */           inv.setItem(x + 1, new ItemStack(Material.AIR));
/*      */         } 
/*      */       }
/*      */     } 
/*      */   }
/*      */   
/*      */   public boolean fixUpdater() {
/* 1275 */     if (this.fileManager.getSignsConfig().getConfigurationSection("Top") == null || this.fileManager.getSignsConfig().getConfigurationSection("Top").getKeys(false).isEmpty()) {
/* 1276 */       if (this.Updater != null) this.Updater.cancel(); 
/* 1277 */       this.Updater = null;
/* 1278 */       this.nextUpdate = 0L;
/* 1279 */       return false;
/*      */     } 
/* 1281 */     if (this.Updater != null) return false; 
/* 1282 */     this.logger.info("[KitBattle] Top signs updater is about to start!");
/* 1283 */     this.Updater = (new BukkitRunnable() {
/*      */         public void run() {
/* 1285 */           main.this.totalUpdates++;
/* 1286 */           main.this.nextUpdate = System.currentTimeMillis() + (main.this.config.UpdateTopSignsEveryInMinutes * 60000);
/* 1287 */           main.this.logger.info("[KitBattle] Updating top signs!");
/*      */           
/* 1289 */           if (main.this.config.useMySQL) {
/*      */             
/*      */             try {
/* 1292 */               Statement sql = main.this.connection.createStatement();
/* 1293 */               ResultSet result = sql.executeQuery("SELECT * FROM " + main.this.config.tableprefix + " ORDER BY Kills");
/* 1294 */               result.findColumn("player_name");
/* 1295 */               Iterator<String> tops = main.this.fileManager.getSignsConfig().getConfigurationSection("Top").getKeys(false).iterator();
/* 1296 */               while (tops.hasNext()) {
/* 1297 */                 final String id = tops.next();
/* 1298 */                 final int rank = Integer.valueOf(id).intValue();
/* 1299 */                 String playerName = null;
/* 1300 */                 int playerKills = 0;
/* 1301 */                 if (result.last()) {
/* 1302 */                   if (rank == 1) {
/* 1303 */                     playerName = result.getString("player_name");
/*      */                   } else {
/* 1305 */                     for (int i = 1; i < rank; i++) {
/* 1306 */                       if (result.previous()) {
/* 1307 */                         playerName = result.getString("player_name");
/*      */                       } else {
/* 1309 */                         playerName = null;
/*      */                       } 
/*      */                     } 
/*      */                   } 
/*      */                 }
/* 1314 */                 if (playerName != null) {
/* 1315 */                   ResultSet killss = main.this.connection.createStatement().executeQuery("SELECT Kills FROM " + main.this.config.tableprefix + " WHERE player_name = '" + playerName + "';");
/* 1316 */                   killss.next();
/* 1317 */                   playerKills = killss.getInt("Kills");
/* 1318 */                   killss.close();
/*      */                 } else {
/* 1320 */                   playerName = "NO_PLAYER";
/*      */                 } 
/*      */                 
/* 1323 */                 if (!tops.hasNext()) {
/* 1324 */                   result.close();
/* 1325 */                   sql.close();
/*      */                 } 
/*      */                 
/* 1328 */                 final String actualName = playerName;
/* 1329 */                 final int actualKills = playerKills;
/* 1330 */                 (new BukkitRunnable()
/*      */                   {
/*      */                     public void run() {
/* 1333 */                       World world = Bukkit.getWorld((main.null.access$0(main.null.this)).fileManager.getSignsConfig().getString("Top." + id + ".world"));
/* 1334 */                       int x = (main.null.access$0(main.null.this)).fileManager.getSignsConfig().getInt("Top." + id + ".x");
/* 1335 */                       int y = (main.null.access$0(main.null.this)).fileManager.getSignsConfig().getInt("Top." + id + ".y");
/* 1336 */                       int z = (main.null.access$0(main.null.this)).fileManager.getSignsConfig().getInt("Top." + id + ".z");
/*      */                       
/* 1338 */                       Block b = world.getBlockAt(x, y, z);
/*      */                       
/* 1340 */                       if (b != null && (b.getType().equals(Material.SIGN) || b.getType().equals(Material.SIGN_POST) || b.getType().equals(Material.WALL_SIGN))) {
/* 1341 */                         Sign s = (Sign)b.getState();
/* 1342 */                         if (s.getLine(0).equals((main.null.access$0(main.null.this)).config.SignsPrefix) && s.getLine(1).equals("Top") && 
/* 1343 */                           main.null.access$0(main.null.this).isNumber(s.getLine(2).replace("#", "").split(" ")[0])) {
/* 1344 */                           s.setLine(2, "#" + rank + " " + actualName);
/* 1345 */                           s.setLine(3, "(" + actualKills + ")");
/* 1346 */                           s.update(true);
/*      */                           
/* 1348 */                           main.null.access$0(main.null.this).updateHead(s.getLocation().add(0.0D, 1.0D, 0.0D), s, actualName);
/*      */                         
/*      */                         }
/*      */                       
/*      */                       }
/*      */                     
/*      */                     }
/* 1355 */                   }).runTask((Plugin)main.plugin);
/*      */               }
/*      */             
/* 1358 */             } catch (SQLException e) {
/* 1359 */               e.printStackTrace();
/*      */             }
/*      */           
/*      */           } else {
/*      */             
/* 1364 */             if (main.this.fileManager.getPlayersConfig().getConfigurationSection("Players") == null)
/* 1365 */               return;  final HashMap<String, Integer> kills = new HashMap<String, Integer>();
/* 1366 */             final HashMap<Integer, String> organizedKills = new HashMap<Integer, String>();
/* 1367 */             final FileConfiguration file = main.this.fileManager.getPlayersConfig();
/* 1368 */             final Iterator<String> players = file.getConfigurationSection("Players").getKeys(false).iterator();
/*      */             
/* 1370 */             (new BukkitRunnable() {
/*      */                 public void run() {
/* 1372 */                   int i = 0;
/* 1373 */                   while (i < 300 && players.hasNext()) {
/* 1374 */                     i++;
/* 1375 */                     String playerName = players.next();
/* 1376 */                     if ((main.null.access$0(main.null.this)).config.UUID) playerName = file.getString("Players." + playerName + ".Name"); 
/* 1377 */                     kills.put(playerName, Integer.valueOf(file.getInt("Players." + playerName + ".Kills")));
/*      */                   } 
/* 1379 */                   if (!players.hasNext()) {
/* 1380 */                     cancel();
/*      */ 
/*      */                     
/* 1383 */                     final Iterator<String> playerNames = kills.keySet().iterator();
/*      */                     
/* 1385 */                     (new BukkitRunnable() {
/*      */                         public void run() {
/* 1387 */                           int i = 0;
/* 1388 */                           while (i < 100 && playerNames.hasNext()) {
/* 1389 */                             i++;
/* 1390 */                             String playerName = playerNames.next();
/* 1391 */                             int playerRank = 1;
/* 1392 */                             int playerKills = ((Integer)kills.get(playerName)).intValue();
/* 1393 */                             for (String anotherPlayer : kills.keySet()) {
/* 1394 */                               if (((Integer)kills.get(anotherPlayer)).intValue() > playerKills) playerRank++; 
/*      */                             } 
/* 1396 */                             organizedKills.put(Integer.valueOf(playerRank), playerName);
/*      */                           } 
/*      */                           
/* 1399 */                           if (!playerNames.hasNext()) {
/* 1400 */                             cancel();
/*      */                             
/* 1402 */                             (new BukkitRunnable() {
/*      */                                 public void run() {
/* 1404 */                                   for (String id : (main.null.access$0(main.null.null.access$0(main.null.null.null.access$0(main.null.null.null.this)))).fileManager.getSignsConfig().getConfigurationSection("Top").getKeys(false))
/*      */                                   {
/* 1406 */                                     World world = Bukkit.getWorld((main.null.access$0(main.null.null.access$0(main.null.null.null.access$0(main.null.null.null.this)))).fileManager.getSignsConfig().getString("Top." + id + ".world"));
/* 1407 */                                     int x = (main.null.access$0(main.null.null.access$0(main.null.null.null.access$0(main.null.null.null.this)))).fileManager.getSignsConfig().getInt("Top." + id + ".x");
/* 1408 */                                     int y = (main.null.access$0(main.null.null.access$0(main.null.null.null.access$0(main.null.null.null.this)))).fileManager.getSignsConfig().getInt("Top." + id + ".y");
/* 1409 */                                     int z = (main.null.access$0(main.null.null.access$0(main.null.null.null.access$0(main.null.null.null.this)))).fileManager.getSignsConfig().getInt("Top." + id + ".z");
/*      */                                     
/* 1411 */                                     Block b = world.getBlockAt(x, y, z);
/*      */                                     
/* 1413 */                                     if (b != null && (b.getType().equals(Material.SIGN) || b.getType().equals(Material.SIGN_POST) || b.getType().equals(Material.WALL_SIGN))) {
/* 1414 */                                       Sign s = (Sign)b.getState();
/* 1415 */                                       if (s.getLine(0).equals((main.null.access$0(main.null.null.access$0(main.null.null.null.access$0(main.null.null.null.this)))).config.SignsPrefix) && s.getLine(1).equals("Top") && 
/* 1416 */                                         main.null.access$0(main.null.null.access$0(main.null.null.null.access$0(main.null.null.null.this))).isNumber(s.getLine(2).replace("#", "").split(" ")[0])) {
/* 1417 */                                         int rank = Integer.valueOf(s.getLine(2).replace("#", "").split(" ")[0]).intValue();
/* 1418 */                                         String playerName = "NO_PLAYER";
/* 1419 */                                         if (organizedKills.containsKey(Integer.valueOf(rank))) {
/* 1420 */                                           playerName = (String)organizedKills.get(Integer.valueOf(rank));
/* 1421 */                                           s.setLine(3, "(" + kills.get(playerName) + ")");
/*      */                                         } else {
/* 1423 */                                           playerName = "NO_PLAYER";
/* 1424 */                                           s.setLine(3, "(0)");
/*      */                                         } 
/* 1426 */                                         s.setLine(2, "#" + rank + " " + playerName);
/* 1427 */                                         s.update(true);
/*      */                                         
/* 1429 */                                         main.null.access$0(main.null.null.access$0(main.null.null.null.access$0(main.null.null.null.this))).updateHead(s.getLocation().add(0.0D, 1.0D, 0.0D), s, playerName);
/*      */                                       }
/*      */                                     
/*      */                                     }
/*      */                                   
/*      */                                   }
/*      */                                 
/*      */                                 }
/* 1437 */                               }).runTask((Plugin)main.plugin);
/*      */                           }
/*      */                         
/*      */                         }
/* 1441 */                       }).runTaskTimerAsynchronously((Plugin)main.plugin, 0L, 1L);
/*      */                   }
/*      */                 
/*      */                 }
/* 1445 */               }).runTaskTimerAsynchronously((Plugin)main.plugin, 0L, 1L);
/*      */           
/*      */           }
/*      */         
/*      */         }
/* 1450 */       }).runTaskTimerAsynchronously((Plugin)this, 0L, (this.config.UpdateTopSignsEveryInMinutes * 1200));
/* 1451 */     this.logger.info("[KitBattle] Top signs updater has started!");
/* 1452 */     return true;
/*      */   }
/*      */   
/*      */   public void updateHead(Location loc, Sign s, String playerName) {
/* 1456 */     Block skull = null;
/*      */     
/* 1458 */     if (loc.getBlock().getType().equals(Material.SKULL)) {
/* 1459 */       skull = loc.getBlock();
/*      */     } else {
/* 1461 */       BlockFace dir = ((Sign)s.getData()).getFacing();
/* 1462 */       if (dir.equals(BlockFace.WEST)) loc.add(1.0D, 0.0D, 0.0D); 
/* 1463 */       if (dir.equals(BlockFace.SOUTH)) loc.add(0.0D, 0.0D, -1.0D); 
/* 1464 */       if (dir.equals(BlockFace.EAST)) loc.add(-1.0D, 0.0D, 0.0D); 
/* 1465 */       if (dir.equals(BlockFace.NORTH)) loc.add(0.0D, 0.0D, 1.0D); 
/* 1466 */       if (loc.getBlock().getType().equals(Material.SKULL)) {
/* 1467 */         skull = loc.getBlock();
/*      */       }
/*      */     } 
/*      */     
/* 1471 */     if (skull != null) {
/* 1472 */       Skull o = (Skull)skull.getState();
/* 1473 */       o.setSkullType(SkullType.PLAYER);
/* 1474 */       o.setOwner(playerName.equals("NO_PLAYER") ? "Notch" : playerName);
/* 1475 */       o.update();
/*      */     } 
/*      */   }
/*      */ }


/* Location:              C:\Users\韩烨均\Documents\Tencent Files\133280410\FileRecv\KitBattle.jar!\me\wazup\kitbattle\main.class
 * Java compiler version: 5 (49.0)
 * JD-Core Version:       1.1.2
 */